package com.intercom;
import java.io.*;
import java.util.ArrayList;
import java.util.List;

import android.util.Log;

public class Utils {
	public static final String MSG_TAG = "TETHER -> NativeTask";

	public static List<String> modified(String path) {
		String line = "";
		List<String> connectedDev = new ArrayList<String>();
		String [] list;

		
		if(path.length() == 0) {
			Log.d(MSG_TAG, "Path not valid.");
		}

		try {
			
			File f = new File (path);
			
			if(!f.exists()) {
				Log.d(MSG_TAG,"File does not exist.");
				throw new IOException();
			}
			
			BufferedReader in = new BufferedReader(new FileReader(path));
			
//			if ( !in.ready() )
//				throw new IOException();
			
			while((line = in.readLine()) != null){
				list = line.split(" ");
				connectedDev.add(list[1] +" - "+ list[2]);
			}

		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			
		}

		return connectedDev;
	}


}
